﻿using LightWadf.Processor;
using LightWadf.Result;
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Web;

namespace Demo.Processor
{
    public class HomeProcessor : AbstractProcessor
    {
        public override void InitRouteRule()
        {
            this.AddRouteRule("/hello", "Hello");
            this.AddRouteRule("/hello/world", "HelloWorld");
            this.AddRouteRule("/hello/guys", "HelloGuys");
            this.AddRouteRule("/hello/user", "HelloUser");
            this.AddRouteRule("/hello/file", "HelloFile");
        }

        public string Hello(HttpContext context)
        {
            context.Response.Write("test ");
            return "hello";
        }

        public string HelloWorld(HttpContext context)
        {
            return "hello world";
        }

        public HtmlResult HelloGuys(HttpContext context)
        {
            return new HtmlResult("View/Home/Hello.html");
        }

        public FileResult HelloFile(HttpContext context)
        {
            return new FileResult("View/Home/Hello.html");
        }

        public RazorResult HelloUser(HttpContext context)
        {
            Dictionary<string, object> model = new Dictionary<string, object>();
            model["Name"] = "test";
            return new RazorResult("View/Home/HelloUser.cshtml", model);
        }
    }
}